const baseURL = 'https://api-hmugo-web.itheima.net/api/public/v1'
let frequency = 0
export default function (parmse) {
    return new Promise((resolve,reject)=>{
        frequency++
        wx.showLoading({
          title: '加载中^-^',
          mask:true
        })
        wx.request({
            ...parmse,
            url:baseURL + parmse.url,
            success:(result)=>{
                resolve(result)
            },
            fail:(err)=>{
                reject(err)
            },
            complete:()=>{
                frequency--
                if (frequency==0) wx.hideLoading()
            }
        })
    })
}